<nav class="navbar navbar-expand-lg bg-body-tertiary shadow-sm">
    <div class="container">
        <a class="navbar-brand" href="{:url('home')}">My Weibo</a>
        <ul class="navbar-nav justify-content-end">
            <?php if(isLogin()):?>
            <?php $user = loginUser();?>
            <li class="nav-item">
                <a class="nav-link" aria-current="page" href="{:url('user/index')}">用户列表</a>
            </li>
            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                    {$user['name']}
                </a>
                <ul class="dropdown-menu">
                    <li><a class="dropdown-item text-center" href="{:url('User/read',['id'=>$user['id']])}">个人中心</a></li>
                    <li><a class="dropdown-item text-center" href="{:url('User/edit',['id'=>$user['id']])}">编辑资料</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li>
                        <form action="{:url('logout')}" method="post" class="text-center"  onsubmit="return confirm('您确定要退出吗');" >
                        <input type="hidden" name="_method" value="DELETE">
                        <button class="btn btn-sm btn-danger" type="submit">退出登录</button>
                    </form>

                    </li>
                </ul>
            </li>
            <?php else:?>
            <li class="nav-item">
                <a class="nav-link" aria-current="page" href="{:url('help')}">帮助</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{:url('login.create')}">登录</a>
            </li>
            <?php endif;?>
        </ul>
    </div>
</nav>









